import request from '@/utils/request'

// 获取供应商列表
export function listSupplier(data) {
    return request({
        url: '/system/supplierInfo/list',
        method: 'get',
        params: data
    })
}

// 获取供应商详细信息
export function detailSupplier(id) {
    return request({
        url: '/system/supplierInfo/getInfo?id=' + id,
        method: 'get'
    })
}

// 供应商增加
export function addSupplier(data) {
    return request({
        url: '/system/supplierInfo/add',
        method: 'post',
        data: data
    })
}

// 供应商编辑
export function editSupplier(data) {
    return request({
        url: '/system/supplierInfo/edit',
        method: 'post',
        data: data
    })
}

// 删除
export function deleteSupplier(id) {
    return request({
        url: '/system/supplierInfo/remove?id=' + id,
        method: 'post'
    })
}

// 审核
export function approveSupplier(id, approveStatus, status, approveRemark) {
    const data = {
        id,
        approveStatus,
        status,
        approveRemark
    }
    return request({
        url: '/system/supplierInfo/approve',
        method: 'post',
        data: data
    })
}

// 启用/禁用
export function enableSupplier(id, status) {
    const data = {
        id,
        status
    }
    return request({
        url: '/system/supplierInfo/enable',
        method: 'post',
        data: data
    })
}